﻿<%@ Page Language="C#" MasterPageFile="~/Theme/Stander/Stander.master" AutoEventWireup="true" CodeFile="search.aspx.cs" Inherits="Finance_search" Title="查找订单－－财务部" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   
       <asp:ScriptManagerProxy id="ScriptManagerProxy1" runat="server">
       </asp:ScriptManagerProxy>
       <script type="text/javascript">
       function SearchType(index)
       {
            var searchType=index;
            
            if(searchType==0)
            {
                divById.style.display="";
                divByDate.style.display="none";
            }
            if(searchType==1)
            {
                divById.style.display="none";
                divByDate.style.display="";
            }
       }
       </script>
       <h1 class="block">查找订单</h1><br />
    <table border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td style="width: 116px; height: 24px">
                &nbsp; 请选择查询方式：</td>
            <td style="width: 164px; height: 24px">
                <asp:DropDownList ID="dlSearchType" onChange="SearchType(this.selectedIndex)" runat="server">
                    <asp:ListItem Selected="True" Value="0">按订单号查询</asp:ListItem>
                    <asp:ListItem Value="1">按日期查询</asp:ListItem>
                </asp:DropDownList></td>
        </tr>
    </table>
    <br />
    <div id="divByDate" style="display:none" >
    <table border="0" cellpadding="0" cellspacing="0" style="height: 40px">
        <tr>
            <td colspan="4" style="font-weight: bold; font-size: 12pt; color: #0099ff;">
                按日期查询：</td>
        </tr>
        <tr>
            <td style="height: 12px; vertical-align: middle;" width="25">
                &nbsp;从</td>
            <td style="height: 12px; vertical-align: middle;" width="120">
                <asp:TextBox ID="txtFirstDate" runat="server" Width="85px"></asp:TextBox>
                <asp:ImageButton ID="ibtnFirstDate" runat="server" ImageUrl="../theme/stander/img/calendar.png"
                    OnClientClick="return false;" />
                <asp:CompareValidator ID="vlacFirstDate" runat="server" ControlToValidate="txtFirstDate"
                    Display="Dynamic" ErrorMessage="日期格式错误！" Operator="DataTypeCheck" Type="Date"
                    ValidationGroup="ByDate"></asp:CompareValidator></td>
            <td style="height: 12px; vertical-align: middle;" width="25">
                &nbsp;到</td>
            <td style="height: 12px; vertical-align: middle;" width="120">
                <asp:TextBox ID="txtLastDate" runat="server" Width="85px"></asp:TextBox>
                <asp:ImageButton ID="ibtnLastDate" runat="server" ImageUrl="../theme/stander/img/calendar.png"
                    OnClientClick="return false;" />
                <asp:CompareValidator ID="valcLastDate" runat="server" ControlToValidate="txtLastDate"
                    Display="Dynamic" ErrorMessage="日期格式错误！" Operator="DataTypeCheck" Type="Date"
                    ValidationGroup="ByDate"></asp:CompareValidator></td>
        </tr>
    </table>
    </div>
    <div id="divById">
    <table border="0" cellpadding="0" cellspacing="0" style="height: 39px">
        <tr>
            <td colspan="2" style="font-weight: bold; font-size: 12pt; color: #0099ff; height: 22px;">
                按订单号查询：</td>
        </tr>
        <tr>
            <td style="vertical-align: middle; height: 20px;" width="60">
                &nbsp;订单号：</td>
            <td style="vertical-align: middle; height: 20px; width: 107px;">
                <asp:TextBox ID="txtId" runat="server" Width="95px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="valrId" runat="server" ControlToValidate="txtId"
                    Display="Dynamic" ErrorMessage="请输入订单号" ValidationGroup="ById"></asp:RequiredFieldValidator></td>
        </tr>
    </table>
    </div>
    <asp:Button ID="btnSearch" runat="server" Text="查找" OnClick="btnSearch_Click" /><cc1:CalendarExtender ID="ceFirstDate" runat="server" TargetControlID="txtFirstDate" PopupButtonID="ibtnFirstDate">
    </cc1:CalendarExtender>
    <cc1:CalendarExtender ID="ceLastDate" runat="server" PopupButtonID="ibtnLastDate" TargetControlID="txtLastDate">
    </cc1:CalendarExtender>
    <asp:Panel ID="pnResult" runat="server" Visible="False" Width="100%">
    <br />
    <h1 class="block">查找结果：</h1><br />
    <asp:Label ID="lblMessage" runat="server" Font-Size="10pt" ForeColor="Red" Text="没有找到你需要的记录！" Visible="False"></asp:Label><br />
    <asp:GridView ID="gvBillList" runat="server" AutoGenerateColumns="False" CssClass="normal mouseOver"
        OnRowDataBound="gvBillList_RowDataBound" PageSize="15" AllowPaging="True" OnPageIndexChanging="gvBillList_PageIndexChanging">
        <Columns>
            <asp:TemplateField HeaderText="订单编号">
            <ItemTemplate>
                <asp:Image id="imgAuditSuccess" runat="server" Visible="False" ImageUrl="~/pics/AuditSuccess.gif" ToolTip="该订单已经结算！" AlternateText="该订单已经结算！"></asp:Image> 
                <asp:Label id="Label1" runat="server" Text='<%# Bind("PactCode") %>'></asp:Label> 
            </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="客户名">
                <ItemTemplate>
                    <asp:Label ID="lblCustomerName" runat="server"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="应收客户">
                <ItemTemplate>
                    <asp:Label ID="lblFinalRealIncome" runat="server"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="已收客户">
                <ItemTemplate>
                    <asp:Label ID="lblAlreadyIncome" runat="server"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="应付媒体">
                <ItemTemplate>
                    <asp:Label ID="lblRealPayout" runat="server"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="已付媒体">
                <ItemTemplate>
                    <asp:Label ID="lblAlreadyPayout" runat="server"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="编辑">
                <ItemTemplate>
                    <asp:HyperLink ID="hlEdit" runat="server" NavigateUrl='<%# Eval("Id", "Accounts.aspx?BillId={0}") %>'
                        Text="管理账目"></asp:HyperLink>
                </ItemTemplate>
             </asp:TemplateField>
        </Columns>
        <PagerSettings PageButtonCount="5" />
    </asp:GridView>
    </asp:Panel>
</asp:Content>

